<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Cat;
use App\Models\User;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        User::factory(10)->create();
        $user1 = User::findOrFail(1);
        $user1->name = '超级管理员';
        $user1->phone = '13800000001';
        $user1->save();
        $user2 = User::findOrFail(2);
        $user2->name = '喜马拉雅';
        $user2->phone = '13800000002';
        $user2->save();
        $user3 = User::findOrFail(3);
        $user3->name = '乔戈里峰';
        $user3->phone = '13800000003';
        $user3->save();
        $this->call([
            CatSeeder::class,
            TopicSeeder::class,
            ConfigSeeder::class,
            CommentSeeder::class
        ]);

        $cat_arr = ['聚焦热点', '财经信息', '娱乐八卦', '体育天地', '母婴空间', '文化历史', '图书走廊', '地产天地', '汽车世界', '热门电影', '网红明星', '饮食男女'];
        foreach ($cat_arr as $k=>$v){
            $cat = Cat::findOrFail($k+1);
            $cat->title = $v;
            $cat->save();
        }
        // \App\Models\User::factory()->create([
        //     'name' => 'Test User',
        //     'email' => 'test@example.com',
        // ]);
    }
}
